import { GameController } from "../../mvc/GameController";
import { GameUI } from "./GameUI";
import { GLoadedButton } from "../../../../com/mui/controls/GLoadedButton";
import { LayerManager } from "../../manager/LayerManager";
//class CopyBitmapWindows
    
    export  class CopyBitmapWindows /* flash.display.Sprite */
    {
        constructor(arg1: Object /* flash.display.BitmapData */=null)
        {
            
            this.mouseChildren = false;
            this.mouseEnabled = false;
            this._bitmap = new Object /* flash.display.Bitmap */(arg1);
            return;
        }

        public /* override */ set width(arg1: number)
        {
            this._bitmap.width = arg1;
            this._bitmap.x = (-this._bitmap.width) / 2;
            return;
        }

        public /* override */ set height(arg1: number)
        {
            this._bitmap.height = arg1;
            this._bitmap.y = (-this._bitmap.height) / 2;
            return;
        }

        public get bitmapData(): Object /* flash.display.BitmapData */
        {
            return this._bitmap.bitmapData;
        }

        public set bitmapData(arg1: Object /* flash.display.BitmapData */)
        {
            this._bitmap.bitmapData = arg1;
            var loc1;
            this._bitmap.scaleY = loc1 = 1;
            this._bitmap.scaleX = loc1;
            this._bitmap.x = (-this._bitmap.width) / 2;
            this._bitmap.y = (-this._bitmap.height) / 2;
            addChild(this._bitmap);
            return;
        }

        public dispose(): void
        {
            if (this._bitmap.bitmapData) 
            {
                this._bitmap.bitmapData.dispose();
                this._bitmap.bitmapData = null;
            }
            if (this._bitmap && this._bitmap.parent) 
            {
                this._bitmap.parent.removeChild(this._bitmap);
            }
            if (this && this.parent) 
            {
                this.parent.removeChild(this);
            }
            return;
        }

        public static getBtn(arg1: string): Object /* flash.display.DisplayObject */
        {
            var loc1=null;
            loc1 = (GameController.gameui.view as GameUI).navbar.getChildByName(arg1) as Object /* flash.display.SimpleButton */;
            if (loc1 == null) 
            {
                loc1 = (GameController.gameui.view as GameUI).smallMap.mapMain.getChildByName(arg1) as Object /* flash.display.SimpleButton */;
            }
            if (loc1 == null) 
            {
                loc1 = (GameController.gameui.view as GameUI).navSprite.btnMap[arg1] as GLoadedButton;
            }
            return loc1;
        }

        public static getBtnPoint(arg1): Object /* flash.geom.Point */
        {
            var loc1=null;
            var loc2=null;
            if (typeof arg1 === "string") 
            {
                loc1 = (GameController.gameui.view as GameUI).navbar.getChildByName(arg1) as Object /* flash.display.SimpleButton */;
                if (loc1 == null) 
                {
                    loc1 = (GameController.gameui.view as GameUI).smallMap.mapMain.getChildByName(arg1) as Object /* flash.display.SimpleButton */;
                }
                if (loc1 == null) 
                {
                    loc1 = (GameController.gameui.view as GameUI).navSprite.btnMap[arg1] as GLoadedButton;
                }
            }
            else if (arg1 is flash.display.DisplayObject) 
            {
                loc1 = arg1;
            }
            if (loc1) 
            {
                loc2 = loc1.getBounds(LayerManager.topLayer);
                return new Object /* flash.geom.Point */(loc2.left + loc2.width / 2, loc2.top + loc2.height / 2);
            }
            return null;
        }

        /* internal */ /* var */_bitmap: Object /* flash.display.Bitmap */;
    }
